Skip to content

Add expression_types(), pattern_types(), binding_types() to DefWithBody#21584

Open
regexident wants to merge 1 commit intorust-lang:masterfrom
regexident:def-with-body-types
Open

Add expression_types(), pattern_types(), binding_types() to DefWithBody#21584
regexident wants to merge 1 commit intorust-lang:masterfrom
regexident:def-with-body-types

Conversation

@regexident
Copy link
Contributor

@regexident regexident commented Feb 4, 2026

This PR builds upon #20683, adding corresponding high-level methods, returning hir::Type<'db>, as opposed hir_ty::Ty<'db>, since the latter are unfortunately sort of unusable from outside of ra_ap.

Context: cargo-modules has been stuck at ra_ap @ 0.0.289 for quite a while now, due to the regression that #20683 was meant to fix (and due to a lack of time on my part), but that PR turned out to be insufficient, hence this PR with follow-up changes.

cc @ChayimFriedman2, since you reviewed the related PR already.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 4, 2026
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hir_ty::Ty should be workable fine outside ra_ap, but you need to import the next-solver.


/// Returns an iterator over the inferred types of all expressions in this body.
///
/// Returns `None` for builtin derive impl methods which don't have inference data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like calling out builtin derive impls like that. Instead we should just return an empty iterator for them (they behave as if they have no body).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants